/*
 * 文件名：WechatConfiguration.java
 * 版权：Copyright 2012-2016 广州宝锶信息技术有限公司
 * 创建人：曾毅
 * 创建时间：2017年9月4日 上午10:16:47
 * 修改人：
 * 修改时间：
 * 修改内容：
 */
package com.baothink.weichat.conf;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import com.typesafe.config.ConfigRenderOptions;

import lombok.extern.slf4j.Slf4j;

/**
 * TODO<一句话功能描述><br>
 * TODO<功能详细描述><br>
 * 
 * @author 曾毅
 * @version 1.0,2017年9月4日 上午10:16:47
 * @since weichat 0.0.1
 */
public class WechatConfiguration {
	
    public static final String root ="wechat";
	
	public static final String conf_name ="WeXinConfig";
	
	public static Config config = init();
	
	static Config init(){
		Config defaultConf = ConfigFactory.load();
		Config custConf = ConfigFactory.load(conf_name);
		Config config = custConf.withFallback(defaultConf).getConfig(root);
		System.out.println(config.root().render(ConfigRenderOptions.concise().setFormatted(true)));
		return config;
		
	}
	
	public static class CC{
		public static final String corp_id = WechatConfiguration.config.getString("CORPID");
		
		
		public static class AGENT{
			public static final Config config = WechatConfiguration.config.getConfig("AGENT");
			
			
			public static class WEI_VISUAL{
				public static final String APP_ID = config.getString("APP_ID");
				public static final String SECRET = config.getString("SECRET");
			}
		}
		
		public static class URL{
			public static final String URL_GET_TOKEN = WechatConfiguration.config.getString("URL.GET_TOKEN");
			
			public static final String URL_GET_USERINFO = WechatConfiguration.config.getString("URL.GET_USERINFO");
			
			public static final String URL_AUTHORIZE = WechatConfiguration.config.getString("URL.AUTHORIZE");
			
			public static final String URL_SENDMESSAGE = WechatConfiguration.config.getString("URL.SENDMESSAGE");
			
			public static final String URL_AGENT_INFO = WechatConfiguration.config.getString("URL.AGENT_INFO");
			
			public static final String URL_DEPT_LIST = WechatConfiguration.config.getString("URL.DEPT_LIST");
			
			public static final String URL_USER_INFO = WechatConfiguration.config.getString("URL.USER_INFO");
		}
	}
	
	public static void main(String[] args) {
		System.out.println(WechatConfiguration.config.root().render(ConfigRenderOptions.concise().setFormatted(true).setComments(false)));
//		System.out.println(WechatConfiguration.config.root().render(ConfigRenderOptions.concise().setFormatted(true)));
		System.out.println(WechatConfiguration.CC.URL.URL_AGENT_INFO);
	}
}
